package com.chennan.algorithm.offer.fore;

/**
 * @author chennan
 * @create 2022-04
 */
public class ReturnMinK {

    public static void main(String[] args) {
        System.out.println(Retuen(new int[]{1,3,4,5,9},2));

    }


    public static int Retuen(int[] nums,int k){
        int min = nums[0]-1;
        int max = nums[nums.length-1];
        int index=0;
        while (max>min){
            min++;
            if(min!=nums[index]){
                k--;
            }else{
                index++;
            }
            if(k==0){
                return min;
            }
        }
        return 0;
    }
}
